import config from './config.js'
import {apiPushUser} from './api.js'
	//开启个推
export default {
	loginInit () {
		uni.showModal({
			title: '登录提醒',
			content: '检测到你尚未登录，请先登录',
			showCancel: false,
			confirmText: '去登录',
			success: res => {
				if(res.confirm){
					uni.redirectTo({
						url: '/pages/login/login'
					});
				}
			}
		});
	},
	token (param={}) {
		return new Promise((resolve,reject)=>{
			uni.request({
				url: config.baseURL+'loginVerify',
				method: 'POST',
				data: param,
				header:{
					'content-type': 'application/x-www-form-urlencoded'
				},
				success: res => {
					console.log(res)
					if(res.statusCode == 200){
						resolve(res.data.token)
					}else{
						reject(res.data)
					}
				}
			});
		})
	}
	
}